<?php
include('conn.php');
$phone=$_REQUEST['phone'];
$message=$_REQUEST['message'];
$sql="select * from reg where phone='$phone'";
$res=$mysqli->query($sql);
var_dump($res);
if($res->num_rows>0){
    echo "<script>alert('该号码已注册')</script>";
echo "<script>location.href='../html/login.html';</script>";
}else{
    $sql1="insert into reg (phone,pwd) values ('$phone','$message')";
    $result=$mysqli->query($sql1);
    if($result){
    echo "<script>alert('注册成功')</script>";
    echo "<script src='../js/cookie.js'></script>";
    echo "<script>cookie.set('isLogin',true,1);cookie.set('user','$phone',1);</script>";
    echo "<script>location.href='../html/index1.html';</script>";
    
    }
}
?>